Skip to content

Conversation

@estebank
Copy link
Contributor

@estebank estebank commented Oct 2, 2025

Formatting the width of a numeric value is limited to a u16, but the macros accept any usize and can panic at runtime. Previously the panic didn't provide any additional information about the failure, other than "too big".

Noticed in https://internals.rust-lang.org/t/diagnostic-for-136932-width-limit/23589

Formatting the width of a numeric value is limited to a `u16`, but the macros accept any `usize` and can panic at runtime. Previously the panic didn't provide any additional information about the failure, other than "too big".
@rustbot
Copy link
Collaborator

rustbot commented Oct 2, 2025

Some changes occurred in library/core/src/fmt/rt.rs

cc @m-ou-se

@rustbot rustbot added S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. T-libs Relevant to the library team, which will review and decide on the PR/issue. labels Oct 2, 2025
@rustbot
Copy link
Collaborator

rustbot commented Oct 2, 2025

r? @Mark-Simulacrum

rustbot has assigned @Mark-Simulacrum.
They will have a look at your PR within the next two weeks and either review your PR or reassign to another reviewer.

Use r? to explicitly pick a reviewer

@rust-log-analyzer
Copy link
Collaborator

The job aarch64-gnu-llvm-20-1 failed! Check out the build log: (web) (plain enhanced) (plain)

Click to see the possible cause of the failure (guessed by this bot)
error[E0015]: cannot call non-const formatting macro in constant functions
    |
   ::: library/core/src/fmt/rt.rs:153:13
    |
153 |               panic!("Formatting argument out of range: `{x}` is bigger than `u16::MAX`");
    |               ---------------------------------------------------------------------------
    |               |
    |               in this macro invocation (#1)
    |               in this macro invocation (#2)
   --> library/core/src/panic.rs:62:38

@estebank estebank closed this Oct 2, 2025
@rustbot rustbot removed the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. label Oct 2, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

T-libs Relevant to the library team, which will review and decide on the PR/issue.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants